//
//  VRLeftMenuViewController.m
//  MyDemos
//
//  Created by Veer on 16/8/23.
//  Copyright © 2016年 veer. All rights reserved.
//

#import "VRLeftMenuViewController.h"
#import "VRScrollCollectionViewController.h"
#import "VRSlideMenuViewController.h"

#import "UIViewController+VRSlideMenu.h"


@interface VRLeftMenuViewController() <UITableViewDelegate, UITableViewDataSource>


@property (strong, nonatomic) UITableView *tableView;

@property (strong, nonatomic) NSArray *titleArray;

@end


@implementation VRLeftMenuViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.titleArray = @[@"QQ钱包", @"网上营业厅",@"个性装扮",@"我的收藏"];
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    [self setupTableView];
    [self setupHeaderView];
}


- (void)setupTableView
{
    
    UITableView *tableView = [[UITableView alloc] init];
    tableView.frame = CGRectMake(0, 100 + 64, Screen_width, Screen_height - 164);
    tableView.backgroundColor = VRColor(38, 184, 242);
    tableView.tableFooterView = [[UIView alloc] init];
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    tableView.delegate = self;
    tableView.dataSource = self;
    [self.view addSubview:tableView];
    self.tableView = tableView;
}

- (void)setupHeaderView
{
    
    UIView *headerView = [[UIView alloc] init];
    headerView.frame = CGRectMake(0, 0, Screen_width, 164);
    headerView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:headerView];
}


#pragma mark - 代理方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.titleArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    static NSString *cellID = @"cellID";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (nil == cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID];
    }
    cell.textLabel.textColor = [UIColor whiteColor];
    cell.textLabel.text = self.titleArray[indexPath.row];
    cell.backgroundColor = [UIColor clearColor];
    
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    VRScrollCollectionViewController *scrollCollectionVc = [[VRScrollCollectionViewController alloc] init];
    [self.slideMenuController showViewController:scrollCollectionVc];
}


@end
